package org.se.lab;

import java.util.ArrayList;
import java.util.List;

public class UserTableImpl implements UserTable {

	private List<User> users = new ArrayList<User>();

	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	@Override
	public void insertUser(User u) {
		if (u == null)
			throw new IllegalArgumentException();

	}

	@Override
	public User findUserById(int id) {

		if (id < 0)
			throw new IllegalArgumentException();

		User result = null;

		for (User a : getUsers()) {
			if (a.getId() == id) {
				result = a;

			}
		}

		return result;
	}

}
